// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   getArryFromValue.java

package include.nseer_cookie;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;

public class getArryFromValue
{

	private String aa[];

	public getArryFromValue()
	{
		aa = new String[1];
	}

	public String[] getArryFromOneValue(String dbName, String table, String field1, String field2, String value, String field_type)
	{
		nseer_db db = new nseer_db(dbName);
		try
		{
			String sql = "";
			if (field_type.equals("0"))
				sql = (new StringBuilder("select ")).append(field1).append(" from ").append(table).append(" where ").append(field2).append("='").append(value).append("' order by id").toString();
			else
				sql = (new StringBuilder("select ")).append(field1).append(" from ").append(table).append(" where ").append(field2).append("='").append(value).append("' and fieldType_tag='1' order by id").toString();
			ResultSet rs = db.executeQuery(sql);
			int i;
			for (i = 0; rs.next(); i++);
			aa = new String[i];
			rs.first();
			for (int j = 0; j < i; j++)
			{
				aa[j] = rs.getString(field1);
				rs.next();
			}

		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		db.close();
		return aa;
	}
}
